<!DOCTYPE html>
<html lang="en-US">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <title>主题开发-自定义指令 | Perfree</title>
    <meta name="description" content="">
    <meta name="generator" content="VuePress 1.8.2">
    <link rel="icon" href="/assets/favicon.ico">
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.slim.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/fancybox/3.5.2/jquery.fancybox.min.js"></script>
    <link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/fancybox/3.5.2/jquery.fancybox.min.css">
    <meta name="description" content="Java开发的建站平台">
    <link rel="preload" href="/assets/css/0.styles.53214819.css" as="style"><link rel="preload" href="/assets/js/app.94968a94.js" as="script"><link rel="preload" href="/assets/js/2.fdc7bca3.js" as="script"><link rel="preload" href="/assets/js/15.e222f376.js" as="script"><link rel="prefetch" href="/assets/js/10.0ff33afc.js"><link rel="prefetch" href="/assets/js/11.c36dbcc6.js"><link rel="prefetch" href="/assets/js/12.92c9567c.js"><link rel="prefetch" href="/assets/js/13.c09257d0.js"><link rel="prefetch" href="/assets/js/14.715bbb46.js"><link rel="prefetch" href="/assets/js/16.bb221be4.js"><link rel="prefetch" href="/assets/js/17.cda3dfb0.js"><link rel="prefetch" href="/assets/js/18.e2582183.js"><link rel="prefetch" href="/assets/js/3.f4d43266.js"><link rel="prefetch" href="/assets/js/4.e03bce9c.js"><link rel="prefetch" href="/assets/js/5.cf1c3294.js"><link rel="prefetch" href="/assets/js/6.d12ee77a.js"><link rel="prefetch" href="/assets/js/7.e7442db3.js"><link rel="prefetch" href="/assets/js/8.a73d51d6.js"><link rel="prefetch" href="/assets/js/9.169d2690.js">
    <link rel="stylesheet" href="/assets/css/0.styles.53214819.css">
  </head>
  <body>
    <div id="app" data-server-rendered="true"><div class="theme-container"><header class="navbar"><div class="ant-row"><div class="sidebar-button"><i aria-label="icon: bars" class="anticon anticon-bars"><svg viewBox="0 0 1024 1024" focusable="false" data-icon="bars" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M912 192H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 284H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 284H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM104 228a56 56 0 1 0 112 0 56 56 0 1 0-112 0zm0 284a56 56 0 1 0 112 0 56 56 0 1 0-112 0zm0 284a56 56 0 1 0 112 0 56 56 0 1 0-112 0z"></path></svg></i> <span></span></div> <div class="ant-col ant-col-xs-24 ant-col-sm-24 ant-col-md-6 ant-col-lg-5 ant-col-xl-5 ant-col-xxl-4"><a href="/" class="router-link-active home-link"><img src="/assets/logo.png" alt="Perfree" class="logo"> <span class="site-name">Perfree</span></a> <div class="search-box mobile-search"><input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div></div> <div class="ant-col ant-col-xs-0 ant-col-sm-0 ant-col-md-18 ant-col-lg-19 ant-col-xl-19 ant-col-xxl-20"><div class="search-box"><input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <nav class="nav-links can-hide"><ul role="menu" id="nav" class="ant-menu ant-menu-horizontal ant-menu-root ant-menu-light"><li role="menuitem" class="ant-menu-submenu ant-menu-submenu-horizontal ant-menu-overflowed-submenu" style="display:none;"><div aria-haspopup="true" class="ant-menu-submenu-title"><span>···</span><i class="ant-menu-submenu-arrow"></i></div></li><li role="menuitem" class="ant-menu-item"><a href="/" class="router-link-active">
          首页
        </a></li><li role="menuitem" class="ant-menu-submenu ant-menu-submenu-horizontal ant-menu-overflowed-submenu" style="display:none;"><div aria-haspopup="true" class="ant-menu-submenu-title"><span>···</span><i class="ant-menu-submenu-arrow"></i></div></li><li role="menuitem" class="ant-menu-item"><a href="/doc/update-record.html">
          更新日志
        </a></li><li role="menuitem" class="ant-menu-submenu ant-menu-submenu-horizontal ant-menu-overflowed-submenu" style="display:none;"><div aria-haspopup="true" class="ant-menu-submenu-title"><span>···</span><i class="ant-menu-submenu-arrow"></i></div></li><li role="menuitem" class="ant-menu-item"><a href="/doc/">
          文档
        </a></li><li role="menuitem" class="ant-menu-submenu ant-menu-submenu-horizontal ant-menu-overflowed-submenu" style="display:none;"><div aria-haspopup="true" class="ant-menu-submenu-title"><span>···</span><i class="ant-menu-submenu-arrow"></i></div></li><li role="menuitem" class="ant-menu-item"><a href="/theme-download/">
          主题下载
        </a></li><li role="menuitem" class="ant-menu-submenu ant-menu-submenu-horizontal ant-menu-overflowed-submenu" style="display:none;"><div aria-haspopup="true" class="ant-menu-submenu-title"><span>···</span><i class="ant-menu-submenu-arrow"></i></div></li><li role="menuitem" class="ant-menu-item ant-menu-item-selected"><a href="/theme-develop/" class="router-link-active">
          主题开发
        </a></li><li role="menuitem" class="ant-menu-submenu ant-menu-submenu-horizontal ant-menu-overflowed-submenu" style="visibility:hidden;position:absolute;"><div aria-haspopup="true" class="ant-menu-submenu-title"><span>···</span><i class="ant-menu-submenu-arrow"></i></div></li></ul> <a href="https://github.com/perfree/PerfreeBlog" target="_blank" rel="noopener noreferrer" class="repo-link"><i aria-label="icon: github" class="anticon anticon-github"><svg viewBox="64 64 896 896" focusable="false" data-icon="github" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M511.6 76.3C264.3 76.2 64 276.4 64 523.5 64 718.9 189.3 885 363.8 946c23.5 5.9 19.9-10.8 19.9-22.2v-77.5c-135.7 15.9-141.2-73.9-150.3-88.9C215 726 171.5 718 184.5 703c30.9-15.9 62.4 4 98.9 57.9 26.4 39.1 77.9 32.5 104 26 5.7-23.5 17.9-44.5 34.7-60.8-140.6-25.2-199.2-111-199.2-213 0-49.5 16.3-95 48.3-131.7-20.4-60.5 1.9-112.3 4.9-120 58.1-5.2 118.5 41.6 123.2 45.3 33-8.9 70.7-13.6 112.9-13.6 42.4 0 80.2 4.9 113.5 13.9 11.3-8.6 67.3-48.8 121.3-43.9 2.9 7.7 24.7 58.3 5.5 118 32.4 36.8 48.9 82.7 48.9 132.3 0 102.2-59 188.1-200 212.9a127.5 127.5 0 0 1 38.1 91v112.5c.8 9 0 17.9 15 17.9 177.1-59.7 304.6-227 304.6-424.1 0-247.2-200.4-447.3-447.5-447.3z"></path></svg></i></a></nav></div></div> <!----></header> <aside class="sidebar"><!----> <ul class="sidebar-links"><li><a href="/theme-develop/" aria-current="page" title="准备" class="sidebar-link">准备</a></li><li><a href="/theme-develop/grammar.html" title="模板语法" class="sidebar-link">模板语法</a></li><li><a href="/theme-develop/variable.html" title="全局变量" class="sidebar-link">全局变量</a></li><li><a href="/theme-develop/directive.html" aria-current="page" title="自定义指令" class="active sidebar-link">自定义指令</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/theme-develop/directive.html#介绍" title="介绍" class="sidebar-link">介绍</a></li><li class="sidebar-sub-header"><a href="/theme-develop/directive.html#articlepage" title="articlePage" class="sidebar-link">articlePage</a></li><li class="sidebar-sub-header"><a href="/theme-develop/directive.html#archivepage" title="archivePage" class="sidebar-link">archivePage</a></li><li class="sidebar-sub-header"><a href="/theme-develop/directive.html#categories" title="categories" class="sidebar-link">categories</a></li><li class="sidebar-sub-header"><a href="/theme-develop/directive.html#commentpage" title="commentPage" class="sidebar-link">commentPage</a></li><li class="sidebar-sub-header"><a href="/theme-develop/directive.html#hotarticle" title="hotArticle" class="sidebar-link">hotArticle</a></li><li class="sidebar-sub-header"><a href="/theme-develop/directive.html#hottag" title="hotTag" class="sidebar-link">hotTag</a></li><li class="sidebar-sub-header"><a href="/theme-develop/directive.html#latestarticle" title="latestArticle" class="sidebar-link">latestArticle</a></li><li class="sidebar-sub-header"><a href="/theme-develop/directive.html#linkpage" title="linkPage" class="sidebar-link">linkPage</a></li><li class="sidebar-sub-header"><a href="/theme-develop/directive.html#mdsummary" title="mdSummary" class="sidebar-link">mdSummary</a></li><li class="sidebar-sub-header"><a href="/theme-develop/directive.html#mdtohtml" title="mdToHtml" class="sidebar-link">mdToHtml</a></li><li class="sidebar-sub-header"><a href="/theme-develop/directive.html#menus" title="menus" class="sidebar-link">menus</a></li><li class="sidebar-sub-header"><a href="/theme-develop/directive.html#nextarticle" title="nextArticle" class="sidebar-link">nextArticle</a></li><li class="sidebar-sub-header"><a href="/theme-develop/directive.html#prearticle" title="preArticle" class="sidebar-link">preArticle</a></li><li class="sidebar-sub-header"><a href="/theme-develop/directive.html#option" title="option" class="sidebar-link">option</a></li><li class="sidebar-sub-header"><a href="/theme-develop/directive.html#pagerender" title="pageRender" class="sidebar-link">pageRender</a></li><li class="sidebar-sub-header"><a href="/theme-develop/directive.html#statistics" title="statistics" class="sidebar-link">statistics</a></li><li class="sidebar-sub-header"><a href="/theme-develop/directive.html#timeago" title="timeAgo" class="sidebar-link">timeAgo</a></li></ul></li><li><a href="/theme-develop/package.html" title="打包主题" class="sidebar-link">打包主题</a></li></ul></aside> <main class="page"> <div class="theme-antdocs-content content__default"><h2 id="介绍"><a href="#介绍" class="header-anchor">#</a> 介绍</h2> <p>自定义指令,使用方法类似于<code>#for #end</code>,如标识了不需要end结束符,则为<code>#mdToHtml()</code></p> <table><thead><tr><th>名称</th> <th style="text-align:center;">是否需要end结束符</th> <th style="text-align:right;">可用页面</th> <th style="text-align:right;">描述</th></tr></thead> <tbody><tr><td>articlePage</td> <td style="text-align:center;">是</td> <td style="text-align:right;">任意</td> <td style="text-align:right;">获取文章列表(分页)</td></tr> <tr><td>archivePage</td> <td style="text-align:center;">是</td> <td style="text-align:right;">任意</td> <td style="text-align:right;">获取文章归档列表(分页)</td></tr> <tr><td>categories</td> <td style="text-align:center;">是</td> <td style="text-align:right;">任意</td> <td style="text-align:right;">获取所有分类</td></tr> <tr><td>commentPage</td> <td style="text-align:center;">是</td> <td style="text-align:right;">文章页(article.html)或任意与页面关联的菜单页(参考perfree主题友链link.html)</td> <td style="text-align:right;">获取评论列表(分页)</td></tr> <tr><td>hotArticle</td> <td style="text-align:center;">是</td> <td style="text-align:right;">任意</td> <td style="text-align:right;">获取N条热门文章</td></tr> <tr><td>hotTag</td> <td style="text-align:center;">是</td> <td style="text-align:right;">任意</td> <td style="text-align:right;">获取N条热门标签</td></tr> <tr><td>latestArticle</td> <td style="text-align:center;">是</td> <td style="text-align:right;">任意</td> <td style="text-align:right;">获取N条最新文章</td></tr> <tr><td>linkPage</td> <td style="text-align:center;">是</td> <td style="text-align:right;">任意</td> <td style="text-align:right;">获取友链列表(分页)</td></tr> <tr><td>mdSummary</td> <td style="text-align:center;">否</td> <td style="text-align:right;">任意</td> <td style="text-align:right;">获取指定文章指定长度简介</td></tr> <tr><td>mdToHtml</td> <td style="text-align:center;">否</td> <td style="text-align:right;">任意</td> <td style="text-align:right;">markdown转html</td></tr> <tr><td>menus</td> <td style="text-align:center;">是</td> <td style="text-align:right;">任意</td> <td style="text-align:right;">获取所有菜单</td></tr> <tr><td>nextArticle</td> <td style="text-align:center;">是</td> <td style="text-align:right;">文章页(article.html)</td> <td style="text-align:right;">获取下一篇文章</td></tr> <tr><td>preArticle</td> <td style="text-align:center;">是</td> <td style="text-align:right;">文章页(article.html)</td> <td style="text-align:right;">获取上一篇文章</td></tr> <tr><td>option</td> <td style="text-align:center;">否</td> <td style="text-align:right;">任意</td> <td style="text-align:right;">获取任意配置项</td></tr> <tr><td>pageRender</td> <td style="text-align:center;">否</td> <td style="text-align:right;">任意,需配合articlePage等分页列表指令</td> <td style="text-align:right;">根据分页信息自动渲染分页html</td></tr> <tr><td>statistics</td> <td style="text-align:center;">是</td> <td style="text-align:right;">任意</td> <td style="text-align:right;">获取文章,标签分类等统计信息</td></tr> <tr><td>timeAgo</td> <td style="text-align:center;">否</td> <td style="text-align:right;">任意</td> <td style="text-align:right;">根据日期获取人性化时间,如1小时前</td></tr></tbody></table> <h2 id="articlepage"><a href="#articlepage" class="header-anchor">#</a> articlePage</h2> <p>该指令用于获取文章分页列表,参数pageSize为每页多少条</p> <div class="language-html line-numbers-mode"><pre class="language-html"><code>#articlePage(pageSize=5)
#end
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br></div></div><p>属性说明</p> <table><thead><tr><th>名称</th> <th style="text-align:center;">类型</th> <th style="text-align:right;">描述</th></tr></thead> <tbody><tr><td>articlePage.data</td> <td style="text-align:center;">集合List</td> <td style="text-align:right;">文章列表数据</td></tr> <tr><td>articlePage.pagers</td> <td style="text-align:center;">集合List</td> <td style="text-align:right;">分页数据</td></tr></tbody></table> <p>示例:</p> <div class="language-html line-numbers-mode"><pre class="language-html"><code>#articlePage(pageSize=5)
    #for(article: articlePage.data)
        <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>div</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>article-box<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>
            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>h2</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>article-title<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>
                <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>a</span> <span class="token attr-name">href</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>#(article.url)<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>#(article.title)<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>a</span><span class="token punctuation">&gt;</span></span>
            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>h2</span><span class="token punctuation">&gt;</span></span>
            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>div</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>article-info<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>
                <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>span</span><span class="token punctuation">&gt;</span></span>作者:#(article.user.userName ??)<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>span</span><span class="token punctuation">&gt;</span></span>
                <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>span</span><span class="token punctuation">&gt;</span></span>时间:#date(article.createTime, &quot;yyyy-MM-dd&quot;)<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>span</span><span class="token punctuation">&gt;</span></span>
                <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>span</span><span class="token punctuation">&gt;</span></span>浏览:#(article.viewCount ??)<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>span</span><span class="token punctuation">&gt;</span></span>
                <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>span</span><span class="token punctuation">&gt;</span></span>评论:#(article.commentCount ??)<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>span</span><span class="token punctuation">&gt;</span></span>
            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>div</span><span class="token punctuation">&gt;</span></span>
            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>div</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>article-content<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>
                #mdSummary(article.content,200)...
            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>div</span><span class="token punctuation">&gt;</span></span>
        <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>div</span><span class="token punctuation">&gt;</span></span>
    #else
        暂无文章
    #end
    #if(articlePage.pagers)
        <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>nav</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>m-pager-box<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>
            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>a</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>m-pager #(articlePage.preUrlStyle)<span class="token punctuation">&quot;</span></span> <span class="token attr-name">href</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>#(articlePage.preUrl ??)<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>上一页<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>a</span><span class="token punctuation">&gt;</span></span>
            #for(page : articlePage.pagers)
                <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>a</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>m-pager #(page.style)<span class="token punctuation">&quot;</span></span> <span class="token attr-name">href</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>#(page.url ??)<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>#(page.text ??)<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>a</span><span class="token punctuation">&gt;</span></span>
            #end
            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>a</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>m-pager #(articlePage.nextUrlStyle)<span class="token punctuation">&quot;</span></span> <span class="token attr-name">href</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>#(articlePage.nextUrl ??)<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>下一页<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>a</span><span class="token punctuation">&gt;</span></span>
        <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>nav</span><span class="token punctuation">&gt;</span></span>
    #end
#end
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br><span class="line-number">16</span><br><span class="line-number">17</span><br><span class="line-number">18</span><br><span class="line-number">19</span><br><span class="line-number">20</span><br><span class="line-number">21</span><br><span class="line-number">22</span><br><span class="line-number">23</span><br><span class="line-number">24</span><br><span class="line-number">25</span><br><span class="line-number">26</span><br><span class="line-number">27</span><br><span class="line-number">28</span><br><span class="line-number">29</span><br></div></div><p>以上示例就完成了文章列表带分页的功能,如果觉得分页过于复杂,可以使用分页指令,渲染默认的分页,如下:</p> <div class="language-html line-numbers-mode"><pre class="language-html"><code>#articlePage(pageSize=5)
    #for(article: articlePage.data)
        <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>div</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>article-box<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>
            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>h2</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>article-title<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>
                <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>a</span> <span class="token attr-name">href</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>#(article.url)<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>#(article.title)<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>a</span><span class="token punctuation">&gt;</span></span>
            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>h2</span><span class="token punctuation">&gt;</span></span>
            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>div</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>article-info<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>
                <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>span</span><span class="token punctuation">&gt;</span></span>作者:#(article.user.userName ??)<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>span</span><span class="token punctuation">&gt;</span></span>
                <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>span</span><span class="token punctuation">&gt;</span></span>时间:#date(article.createTime, &quot;yyyy-MM-dd&quot;)<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>span</span><span class="token punctuation">&gt;</span></span>
                <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>span</span><span class="token punctuation">&gt;</span></span>浏览:#(article.viewCount ??)<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>span</span><span class="token punctuation">&gt;</span></span>
                <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>span</span><span class="token punctuation">&gt;</span></span>评论:#(article.commentCount ??)<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>span</span><span class="token punctuation">&gt;</span></span>
            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>div</span><span class="token punctuation">&gt;</span></span>
            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>div</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>article-content<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>
                #mdSummary(article.content,200)...
            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>div</span><span class="token punctuation">&gt;</span></span>
        <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>div</span><span class="token punctuation">&gt;</span></span>
    #else
        暂无文章
    #end

    #pageRender(articlePage, preText=&quot;上一页&quot;,nextText=&quot;下一页&quot;)
#end
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br><span class="line-number">16</span><br><span class="line-number">17</span><br><span class="line-number">18</span><br><span class="line-number">19</span><br><span class="line-number">20</span><br><span class="line-number">21</span><br><span class="line-number">22</span><br></div></div><h2 id="archivepage"><a href="#archivepage" class="header-anchor">#</a> archivePage</h2> <p>文章归档列表数据分页,参数pageSize为每页多少条</p> <div class="language-html line-numbers-mode"><pre class="language-html"><code>#archivePage(pageSize=12)
#end
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br></div></div><p>属性说明</p> <table><thead><tr><th>名称</th> <th style="text-align:center;">类型</th> <th style="text-align:right;">描述</th></tr></thead> <tbody><tr><td>archivePage.data</td> <td style="text-align:center;">集合List</td> <td style="text-align:right;">文章列表数据</td></tr> <tr><td>archivePage.pagers</td> <td style="text-align:center;">集合List</td> <td style="text-align:right;">分页数据</td></tr></tbody></table> <p>示例:</p> <div class="language-html line-numbers-mode"><pre class="language-html"><code>#archivePage(pageSize=12)
    #for(archive: archivePage.data)
        #for(archiveArticle: archive.articles)
            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>a</span> <span class="token attr-name">href</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>#(archiveArticle.url)<span class="token punctuation">&quot;</span></span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>m-archive-link<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>
                #date(archiveArticle.createTime, &quot;MM/dd&quot;)：<span class="token entity named-entity" title="&amp;nbsp;">&amp;nbsp;</span>#(archiveArticle.title)
            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>a</span><span class="token punctuation">&gt;</span></span>
        #end
    #else
        暂无文章
    #end
    #pageRender(archivePage, preText=&quot;上一页&quot;,nextText=&quot;下一页&quot;)
#end
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br></div></div><h2 id="categories"><a href="#categories" class="header-anchor">#</a> categories</h2> <p>获取所有分类</p> <div class="language-html line-numbers-mode"><pre class="language-html"><code> #categories()
 #end
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br></div></div><p>示例:</p> <div class="language-html line-numbers-mode"><pre class="language-html"><code>#categories()
    #for(category: categories)
        <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>dd</span> <span class="token attr-name">lay-unselect</span><span class="token punctuation">&gt;</span></span>
            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>a</span> <span class="token attr-name">href</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>#(category.url)<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>
                #(category.name ??)
                <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>span</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>empty<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>span</span><span class="token punctuation">&gt;</span></span>
                <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>span</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>layui-badge-rim<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>#(category.count ??)<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>span</span><span class="token punctuation">&gt;</span></span>
            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>a</span><span class="token punctuation">&gt;</span></span>
        <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>dd</span><span class="token punctuation">&gt;</span></span>
    #end
#end
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br></div></div><h2 id="commentpage"><a href="#commentpage" class="header-anchor">#</a> commentPage</h2> <blockquote><p>引入评论的话建议使用自带的评论组件,使用只需要以下步骤即可</p> <ul><li>引入css<code>&lt;link href=&quot;/static/public/components/comment/comment.css&quot; rel=&quot;stylesheet&quot;&gt;</code></li> <li>引入页面<code>#include(&quot;/static/public/components/comment/comment.html&quot;)</code></li> <li>引入js<code>&lt;script src=&quot;/static/public/components/comment/comment.js&quot;&gt;&lt;/script&gt;</code></li></ul></blockquote> <p>获取评论列表分页数据,该指令只能在文章页(article.html)或任意与页面关联的菜单页使用(参考perfree主题的link.html),参数pageSize为每页多少条</p> <div class="language-html line-numbers-mode"><pre class="language-html"><code>#commentPage(pageSize=6)
#end
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br></div></div><p>属性说明</p> <table><thead><tr><th>名称</th> <th style="text-align:center;">类型</th> <th style="text-align:right;">描述</th></tr></thead> <tbody><tr><td>commentPage.data</td> <td style="text-align:center;">集合List</td> <td style="text-align:right;">评论列表数据</td></tr> <tr><td>commentPage.pagers</td> <td style="text-align:center;">集合List</td> <td style="text-align:right;">分页数据</td></tr></tbody></table> <p>示例:</p> <div class="language-html line-numbers-mode"><pre class="language-html"><code>#commentPage(pageSize=6)
     #for(comment : commentPage.data)
        #for(comment : commentPage.data)
        #end
     #else
        暂无评论
     #end
    #pageRender(commentPage, anchor=&quot;#commentList&quot;,preText=&quot;上一页&quot;,nextText=&quot;下一页&quot;)
#end
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br></div></div><h2 id="hotarticle"><a href="#hotarticle" class="header-anchor">#</a> hotArticle</h2> <p>获取热门文章参数count获取多少条,type热门文章类型0按照评论数,1按照浏览量</p> <div class="language-html line-numbers-mode"><pre class="language-html"><code>#hotArticle(count=10,type=0)
#end
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br></div></div><p>示例</p> <div class="language-html line-numbers-mode"><pre class="language-html"><code> #hotArticle(count=10,type=0)
    #for(article : articles)
        <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>li</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>m-right-article<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>
            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>a</span> <span class="token attr-name">href</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>#(article.url)<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>#(article.title)<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>a</span><span class="token punctuation">&gt;</span></span>
        <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>li</span><span class="token punctuation">&gt;</span></span>
    #else
        暂无文章
    #end
#end
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br></div></div><h2 id="hottag"><a href="#hottag" class="header-anchor">#</a> hotTag</h2> <p>获取热门标签,参数count获取多少条</p> <div class="language-html line-numbers-mode"><pre class="language-html"><code>#hotTag(count=10)
#end
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br></div></div><p>示例</p> <div class="language-html line-numbers-mode"><pre class="language-html"><code>#hotTag(count=10)
    #for(tag : tags)
        <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>a</span> <span class="token attr-name">href</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>#(tag.url)<span class="token punctuation">&quot;</span></span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>m-right-tag<span class="token punctuation">&quot;</span></span> <span class="token attr-name">title</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>共#(tag.articleCount ??)篇文章<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>#(tag.name)<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>a</span><span class="token punctuation">&gt;</span></span>
    #end
#end
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br></div></div><h2 id="latestarticle"><a href="#latestarticle" class="header-anchor">#</a> latestArticle</h2> <p>获取最新文章,参数count获取多少条</p> <div class="language-html line-numbers-mode"><pre class="language-html"><code>#latestArticle(count=10)
#end
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br></div></div><p>示例:</p> <div class="language-html line-numbers-mode"><pre class="language-html"><code>#latestArticle(count=10)
    #for(article : articles)
        <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>li</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>m-right-article<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>
            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>a</span> <span class="token attr-name">href</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>#(article.url)<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>#(article.title)<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>a</span><span class="token punctuation">&gt;</span></span>
        <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>li</span><span class="token punctuation">&gt;</span></span>
    #else
        暂无文章
    #end
#end
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br></div></div><h2 id="linkpage"><a href="#linkpage" class="header-anchor">#</a> linkPage</h2> <p>获取友链分页列表数据,参数pageSize为每页多少条</p> <div class="language-html line-numbers-mode"><pre class="language-html"><code>#linkPage(pageSize=12)
#end
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br></div></div><p>属性说明</p> <table><thead><tr><th>名称</th> <th style="text-align:center;">类型</th> <th style="text-align:right;">描述</th></tr></thead> <tbody><tr><td>linkPage.data</td> <td style="text-align:center;">集合List</td> <td style="text-align:right;">文章列表数据</td></tr> <tr><td>linkPage.pagers</td> <td style="text-align:center;">集合List</td> <td style="text-align:right;">分页数据</td></tr></tbody></table> <p>示例:</p> <div class="language-html line-numbers-mode"><pre class="language-html"><code>#linkPage(pageSize=12)
    #for(link: linkPage.data)
    #else
        暂无数据
    #end
    #pageRender(linkPage, preText=&quot;上一页&quot;,nextText=&quot;下一页&quot;)
#end
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br></div></div><h2 id="mdsummary"><a href="#mdsummary" class="header-anchor">#</a> mdSummary</h2> <p>获取指定文章指定长度简介,需要传入文章内容和获取简介的长度</p> <div class="language-html line-numbers-mode"><pre class="language-html"><code>#mdSummary(article.content,200)
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><h2 id="mdtohtml"><a href="#mdtohtml" class="header-anchor">#</a> mdToHtml</h2> <p>将markdown转为html,需要传入markdown内容</p> <div class="language-html line-numbers-mode"><pre class="language-html"><code>#mdToHtml(article.content ??)
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><h2 id="menus"><a href="#menus" class="header-anchor">#</a> menus</h2> <p>获取菜单列表</p> <div class="language-html line-numbers-mode"><pre class="language-html"><code>#menus()
    #for(menu : menus)
        <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>li</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>layui-nav-item<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>
            <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>a</span> <span class="token attr-name">href</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>#(menu.url ??)<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>i</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>fa #(menu.icon ??)<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>i</span><span class="token punctuation">&gt;</span></span> #(menu.name ??)<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>a</span><span class="token punctuation">&gt;</span></span>
        <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>li</span><span class="token punctuation">&gt;</span></span>
        #if(menu.childMenu &amp;&amp; menu.childMenu)
            #for(childMenu: menu.childMenu)
                子菜单
            #end
        #end
    #end
#end
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br></div></div><h2 id="nextarticle"><a href="#nextarticle" class="header-anchor">#</a> nextArticle</h2> <p>获取下一篇文章,该指令需要在文章页使用</p> <div class="language-html line-numbers-mode"><pre class="language-html"><code>#nextArticle()
    #if(nextArticle)
        <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>a</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>a-next-article<span class="token punctuation">&quot;</span></span> <span class="token attr-name">href</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>#(nextArticle.url)<span class="token punctuation">&quot;</span></span> <span class="token attr-name">title</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>#(nextArticle.title)<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>下一篇 <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>i</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>fa fa-angle-right<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>i</span><span class="token punctuation">&gt;</span></span><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>a</span><span class="token punctuation">&gt;</span></span>
    #end
#end
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br></div></div><h2 id="prearticle"><a href="#prearticle" class="header-anchor">#</a> preArticle</h2> <p>获取上一篇文章,该指令需要在文章页使用</p> <div class="language-html line-numbers-mode"><pre class="language-html"><code> #preArticle()
    #if(preArticle)
        <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>a</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>a-pre-article<span class="token punctuation">&quot;</span></span> <span class="token attr-name">href</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>#(preArticle.url)<span class="token punctuation">&quot;</span></span> <span class="token attr-name">title</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>#(preArticle.title)<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>
                <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>i</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>fa fa-angle-left<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>i</span><span class="token punctuation">&gt;</span></span> 上一篇
        <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>a</span><span class="token punctuation">&gt;</span></span>
    #end
#end
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br></div></div><h2 id="option"><a href="#option" class="header-anchor">#</a> option</h2> <p>用于读取指定的配置信息,可配合主题setting.html实现自由配置网站,setting.html保存option,前台读取option,该指令需要传入需要读取的key以及默认值</p> <div class="language-html line-numbers-mode"><pre class="language-html"><code>#option('WEB_NAME','未设置')
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><h2 id="pagerender"><a href="#pagerender" class="header-anchor">#</a> pageRender</h2> <p>用于分页渲染,在前边几个分页列表指令中已经演示了怎么使用,这里描述下具体的参数</p> <div class="language-html line-numbers-mode"><pre class="language-html"><code> #pageRender(articlePage, preText=&quot;上一页&quot;,nextText=&quot;下一页&quot;)
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><p>第一个参数为当前分页指令数据,preText为上一页的文字,nextText为下一页的文字</p> <h2 id="statistics"><a href="#statistics" class="header-anchor">#</a> statistics</h2> <p>用于获取统计信息</p> <div class="language-html line-numbers-mode"><pre class="language-html"><code> #statistics()
    <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>div</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>m-info-other<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>
        <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>span</span><span class="token punctuation">&gt;</span></span>文章<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>span</span><span class="token punctuation">&gt;</span></span>
        <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>span</span><span class="token punctuation">&gt;</span></span>#(statistics.articleCount)篇<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>span</span><span class="token punctuation">&gt;</span></span>
    <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>div</span><span class="token punctuation">&gt;</span></span>
    <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>div</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>m-info-other<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>
        <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>span</span><span class="token punctuation">&gt;</span></span>评论<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>span</span><span class="token punctuation">&gt;</span></span>
        <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>span</span><span class="token punctuation">&gt;</span></span>#(statistics.commentCount)条<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>span</span><span class="token punctuation">&gt;</span></span>
    <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>div</span><span class="token punctuation">&gt;</span></span>
    <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>div</span> <span class="token attr-name">class</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>m-info-other<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>
        <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>span</span><span class="token punctuation">&gt;</span></span>标签<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>span</span><span class="token punctuation">&gt;</span></span>
        <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>span</span><span class="token punctuation">&gt;</span></span>#(statistics.tagCount)个<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>span</span><span class="token punctuation">&gt;</span></span>
    <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>div</span><span class="token punctuation">&gt;</span></span>
#end
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br></div></div><h2 id="timeago"><a href="#timeago" class="header-anchor">#</a> timeAgo</h2> <p>获取人性化时间,如两小时前,一天前等</p> <div class="language-html line-numbers-mode"><pre class="language-html"><code>#timeAgo(comment.createTime)
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div></div> <footer class="page-edit"><!----> <div class="last-updated"><span class="prefix">Last Updated:</span> <span class="time">12/27/2020, 8:46:02 PM</span></div></footer> <div class="page-nav"><p class="inner"><span class="prev"><a href="/theme-develop/variable.html" class="prev"><i aria-label="icon: left" class="anticon anticon-left"><svg viewBox="64 64 896 896" focusable="false" data-icon="left" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M724 218.3V141c0-6.7-7.7-10.4-12.9-6.3L260.3 486.8a31.86 31.86 0 0 0 0 50.3l450.8 352.1c5.3 4.1 12.9.4 12.9-6.3v-77.3c0-4.9-2.3-9.6-6.1-12.6l-360-281 360-281.1c3.8-3 6.1-7.7 6.1-12.6z"></path></svg></i>
        全局变量
      </a></span> <span class="next"><a href="/theme-develop/package.html">
        打包主题
        <i aria-label="icon: right" class="anticon anticon-right"><svg viewBox="64 64 896 896" focusable="false" data-icon="right" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M765.7 486.8L314.9 134.7A7.97 7.97 0 0 0 302 141v77.3c0 4.9 2.3 9.6 6.1 12.6l360 281.1-360 281.1c-3.9 3-6.1 7.7-6.1 12.6V883c0 6.7 7.7 10.4 12.9 6.3l450.8-352.1a31.96 31.96 0 0 0 0-50.4z"></path></svg></i></a></span></p></div> </main> <!----></div><div class="global-ui"></div></div>
    <script src="/assets/js/app.94968a94.js" defer></script><script src="/assets/js/2.fdc7bca3.js" defer></script><script src="/assets/js/15.e222f376.js" defer></script>
  </body>
</html>